<template>
  <div class="container">
    <p class="title">
      <span style="color: #fff"> 安徽省特种设备检测院电子评分系统 </span>
    </p>
    <div class="table_container">
      <div class="main-title">
        <img src="@/assets/urban-development-indicators/icon.png" alt="" />
        <div class="text">{{ examCandidate.workTypeName }}</div>
      </div>
      <table
        cellspacing="0"
        cellpadding="0"
        style="
          table-layout: fixed;
          width: 100%;
          border-collapse: collapse;
          margin: 0 auto;
        "
      >
        <tr style="height: 25.5pt">
          <td colspan="2" style="width: 73.75pt">
            <p class="label">
              <span class="labelFont">考号</span>
            </p>
          </td>
          <td colspan="4" style="width: 253.55pt">
            <p class="label">
              <span class="labelFont">{{ examCandidate.number }} </span>
            </p>
          </td>
          <td rowspan="4" colspan="2" style="width: 117.35pt">
            <p class="label">
              <span class="labelFont">总得分</span>
            </p>
          </td>
          <td colspan="4" rowspan="4" style="width: 59.1pt">
            <p class="label">
              <span class="labelFont">{{ sum }}</span>
            </p>
          </td>
        </tr>
        <tr style="height: 25.5pt">
          <td colspan="2" style="width: 73.75pt">
            <p class="label">
              <span class="labelFont">姓名</span>
            </p>
          </td>
          <td colspan="4" style="width: 253.55pt">
            <p class="label">
              <span class="labelFont">{{ examCandidate.name }}</span>
            </p>
          </td>
        </tr>
        <tr style="height: 25.5pt">
          <td colspan="2" style="width: 73.75pt">
            <p class="label">
              <span class="labelFont">身份证号</span>
            </p>
          </td>
          <td colspan="4" style="width: 253.55pt">
            <p class="label">
              <span class="labelFont">{{ examCandidate.sfzNumber }} </span>
            </p>
          </td>
        </tr>
        <tr style="height: 25.5pt">
          <td colspan="2" style="width: 73.75pt">
            <p class="label">
              <span class="labelFont">考试批次</span>
            </p>
          </td>
          <td colspan="4" style="width: 253.55pt">
            <p class="label">
              <span class="labelFont">{{ examCandidate.batchNumber }} </span>
            </p>
          </td>
        </tr>
        <tr class="trZdy1" style="height: 5.7pt">
          <td style="width: 22.8pt">
            <p class="label">
              <span class="labelFont">序号</span>
            </p>
          </td>
          <td colspan="2" style="width: 40.15pt">
            <p class="label">
              <span class="labelFont">考试要求</span>
            </p>
          </td>

          <td colspan="5" style="width: 117.35pt">
            <p class="label">
              <span class="labelFont">考核记录</span>
            </p>
          </td>
          <td colspan="2" style="width: 60.15pt">
            <p>
              <span class="labelFont">配分</span>
            </p>
          </td>
          <td colspan="2" style="width: 25.15pt">
            <p class="label">
              <span class="labelFont">得分</span>
            </p>
          </td>
        </tr>
        <tr style="height: 56.7pt">
          <td rowspan="4" style="width: 22.8pt">
            <p class="label">
              <span class="labelFont">1</span>
            </p>
          </td>
          <td rowspan="4" style="width: 40.15pt">
            <p class="label">
              <span class="labelFont">部件识别（30%）</span>
            </p>
          </td>
          <td rowspan="1">
            <div
              style="
                width: 100%;
                height: 150px;
                display: flex;
                align-items: center;
                justify-content: center;
                font-size: 10pt;
                font-family: 宋体;
              "
            >
              {{ questionArr1[0].questionTypeName }}
            </div>
          </td>
          <td colspan="5" style="width: 117.35pt">
            <div
              style="
                margin: 0pt;
                orphans: 0;
                text-align: justify;
                widows: 0;
                margin-bottom: 15px;
              "
            >
              <span class="labelFont"
                >题号：
                <span>{{ questionArr1[0].questionName }}</span>
                <span
                  class="scorePoint"
                  @click="clickHandle(questionArr1[0].id)"
                  >查看得分点</span
                ></span
              >
            </div>
            <p style="margin: 0pt; orphans: 0; text-align: justify; widows: 0">
              <span style="font-family: 宋体; font-size: 10pt; display: flex"
                ><span></span
                ><Checked
                  :questionNum="1"
                  :checked="disabled"
                  :status="examRecord.status"
                  :radioStatus="questionArr1[0].record"
                  @getScoreState="getState"
                ></Checked>
              </span>
            </p>
          </td>
          <td colspan="2" style="width: 23.15pt">
            <p class="label">
              <span class="labelFont">
                <input id="input" readonly type="number" value="8" />
              </span>
            </p>
          </td>
          <td colspan="2" style="width: 60.15pt">
            <p class="label">
              <span class="labelFont">
                <input
                  type="number"
                  oninput="if(value>8)value=8;if(value.length>1)value=value.slice(0,1);if(value<0)value=0"
                  name=""
                  v-model="scoreOne"
                  :disabled="disabledScore1"
                />
              </span>
            </p>
          </td>
        </tr>
        <tr style="height: 56.7pt">
          <td rowspan="1">
            <div
              style="
                width: 100%;
                height: 150px;
                display: flex;
                align-items: center;
                justify-content: center;
                font-size: 10pt;
                font-family: 宋体;
              "
            >
              {{ questionArr2[0].questionTypeName }}
            </div>
          </td>
          <td colspan="5" style="width: 117.35pt">
            <div
              style="
                margin: 0pt;
                orphans: 0;
                text-align: justify;
                widows: 0;
                margin-bottom: 15px;
              "
            >
              <span class="labelFont"
                >题号：
                <span>{{ questionArr2[0].questionName }}</span>
                <span
                  class="scorePoint"
                  @click="clickHandle(questionArr2[0].id)"
                  >查看得分点</span
                >
              </span>
            </div>
            <p style="margin: 0pt; orphans: 0; text-align: justify; widows: 0">
              <span style="font-family: 宋体; font-size: 10pt; display: flex"
                ><span> </span
                ><Checked
                  :questionNum="2"
                  :checked="disabled"
                  :status="examRecord.status"
                  :radioStatus="questionArr2[0].record"
                  @getScoreState="getState"
                ></Checked>
              </span>
            </p>
          </td>
          <td colspan="2" style="width: 23.15pt">
            <p class="label">
              <span class="labelFont">
                <input id="input" readonly type="number" value="8" />
              </span>
            </p>
          </td>
          <td colspan="2" style="width: 25.15pt">
            <p class="label">
              <span class="labelFont">
                <input
                  type="number"
                  oninput="if(value>8)value=8;if(value.length>1)value=value.slice(0,1);if(value<0)value=0"
                  name=""
                  v-model="scoreTwo"
                  :disabled="disabledScore2"
                />
              </span>
            </p>
          </td>
        </tr>
        <tr style="height: 56.7pt">
          <td rowspan="1">
            <div
              style="
                width: 100%;
                height: 150px;
                display: flex;
                align-items: center;
                justify-content: center;
                font-size: 10pt;
                font-family: 宋体;
              "
            >
              {{ questionArr3[0].questionTypeName }}
            </div>
          </td>
          <td colspan="5" style="width: 117.35pt">
            <div
              style="
                margin: 0pt;
                orphans: 0;
                text-align: justify;
                widows: 0;
                margin-bottom: 15px;
              "
            >
              <span class="labelFont"
                >题号：
                <span>{{ questionArr3[0].questionName }}</span>
                <span
                  class="scorePoint"
                  @click="clickHandle(questionArr3[0].id)"
                  >查看得分点</span
                >
              </span>
            </div>
            <p style="margin: 0pt; orphans: 0; text-align: justify; widows: 0">
              <span style="font-family: 宋体; font-size: 10pt; display: flex"
                ><span> </span
                ><Checked
                  :questionNum="3"
                  :checked="disabled"
                  :status="examRecord.status"
                  :radioStatus="questionArr3[0].record"
                  @getScoreState="getState"
                ></Checked>
              </span>
            </p>
          </td>
          <td colspan="2" style="width: 23.15pt">
            <p class="label">
              <span class="labelFont">
                <input id="input" readonly type="number" value="8" />
              </span>
            </p>
          </td>
          <td colspan="2" style="width: 25.15pt">
            <p class="label">
              <span class="labelFont">
                <input
                  type="number"
                  oninput="if(value>8)value=8;if(value.length>1)value=value.slice(0,1);if(value<0)value=0"
                  name=""
                  v-model="scoreThree"
                  :disabled="disabledScore3"
                />
              </span>
            </p>
          </td>
        </tr>
        <tr style="height: 56.7pt">
          <td rowspan="1">
            <div
              style="
                width: 100%;
                height: 150px;
                display: flex;
                align-items: center;
                justify-content: center;
                font-size: 10pt;
                font-family: 宋体;
              "
            >
              {{ questionArr4[0].questionTypeName }}
            </div>
          </td>
          <td colspan="5" style="width: 117.35pt">
            <div
              style="
                margin: 0pt;
                orphans: 0;
                text-align: justify;
                widows: 0;
                margin-bottom: 15px;
              "
            >
              <span class="labelFont"
                >题号：
                <span>{{ questionArr4[0].questionName }}</span>
                <span
                  class="scorePoint"
                  @click="clickHandle(questionArr4[0].id)"
                  >查看得分点</span
                >
              </span>
            </div>
            <div style="display: flex">
              <p
                style="
                  margin: 0pt;
                  orphans: 0;
                  text-align: justify;
                  widows: 0;
                  width: 300px;
                "
              >
                <span style="font-family: 宋体; font-size: 10pt; display: flex"
                  ><span></span
                  ><Checked
                    :questionNum="4"
                    :checked="disabled"
                    :status="examRecord.status"
                    :radioStatus="questionArr4[0].record"
                    @getScoreState="getState"
                  ></Checked>
                </span>
              </p>
              <p
                style="
                  display: flex;
                  justify-content: space-around;
                  width: 200px;
                "
              >
                <img
                  class="img1"
                  v-if="questionArr4[0].questionImage1"
                  @click="checkedImg(1, questionArr4[0].questionImage1)"
                  :src="'/api' + questionArr4[0].questionImage1"
                  alt=""
                />
                <img
                  class="img2"
                  v-if="questionArr4[0].questionImage2"
                  @click="checkedImg(2, questionArr4[0].questionImage2)"
                  :src="'/api' + questionArr4[0].questionImage2"
                  alt=""
                />
              </p>
            </div>
          </td>
          <td colspan="2" style="width: 23.15pt">
            <p class="label">
              <span class="labelFont">
                <input id="input" readonly type="number" value="6" />
              </span>
            </p>
          </td>
          <td colspan="2" style="width: 25.15pt">
            <p class="label">
              <span class="labelFont">
                <input
                  type="number"
                  oninput="if(value>6)value=6;if(value.length>1)value=value.slice(0,1);if(value<0)value=0"
                  name=""
                  v-model="scoreFour"
                  :disabled="disabledScore4"
                />
              </span>
            </p>
          </td>
        </tr>
        <tr style="height: 59.55pt">
          <td rowspan="1" style="width: 22.8pt">
            <p class="label">
              <span class="labelFont">3</span>
            </p>
          </td>
          <td rowspan="1" style="width: 40.15pt">
            <p class="label">
              <span class="labelFont">应急处置能力（20%）</span>
            </p>
          </td>
          <td rowspan="1">
            <div
              style="
                width: 100%;
                height: 150px;
                display: flex;
                align-items: center;
                justify-content: center;
                font-size: 10pt;
                font-family: 宋体;
              "
            >
              {{ questionArr5[0].questionTypeName }}
            </div>
          </td>
          <td colspan="5" style="width: 117.35pt">
            <div
              style="
                margin: 0pt;
                orphans: 0;
                text-align: justify;
                widows: 0;
                margin-bottom: 15px;
              "
            >
              <span class="labelFont"
                >题号：
                <span>{{ questionArr5[0].questionName }}</span>
                <span
                  class="scorePoint"
                  @click="clickHandle(questionArr5[0].id)"
                  >查看得分点</span
                >
              </span>
            </div>
            <p style="margin: 0pt; orphans: 0; text-align: justify; widows: 0">
              <span style="font-family: 宋体; font-size: 10pt; display: flex"
                ><span></span
                ><Checked
                  :questionNum="5"
                  :checked="disabled"
                  :status="examRecord.status"
                  :radioStatus="questionArr5[0].record"
                  @getScoreState="getState"
                ></Checked>
              </span>
            </p>
          </td>
          <td colspan="2" style="width: 23.15pt">
            <p class="label">
              <span class="labelFont">
                <input id="input" readonly type="number" value="20" />
              </span>
            </p>
          </td>
          <td colspan="2" style="width: 25.15pt">
            <p class="label">
              <span class="labelFont">
                <input
                  type="number"
                  oninput="if(value>20)value=20;if(value.length>2)value=value.slice(0,2);if(value<0)value=0"
                  name=""
                  v-model="scoreFive"
                  :disabled="disabledScore5"
                />
              </span>
            </p>
          </td>
        </tr>
        <tr style="height: 59.55pt">
          <td rowspan="4" style="width: 22.8pt">
            <p class="label">
              <span class="labelFont">2</span>
            </p>
          </td>
          <td rowspan="4" style="width: 40.15pt">
            <p class="label">
              <span class="labelFont">基本操作能力（50%）</span>
            </p>
          </td>
          <td rowspan="1">
            <div
              style="
                width: 100%;
                height: 150px;
                display: flex;
                align-items: center;
                justify-content: center;
                font-size: 10pt;
                font-family: 宋体;
              "
            >
              {{ questionArr6[0].questionTypeName }}
            </div>
          </td>
          <td colspan="5" style="width: 117.35pt">
            <div
              style="
                margin: 0pt;
                orphans: 0;
                text-align: justify;
                widows: 0;
                margin-bottom: 15px;
              "
            >
              <span class="labelFont"
                >题号：
                <span>{{ questionArr6[0].questionName }}</span>
                <span
                  class="scorePoint"
                  @click="clickHandle(questionArr6[0].id)"
                  >查看得分点</span
                >
              </span>
            </div>
            <p style="margin: 0pt; orphans: 0; text-align: justify; widows: 0">
              <span style="font-family: 宋体; font-size: 10pt; display: flex"
                ><span></span
                ><Checked
                  :questionNum="6"
                  :checked="disabled2"
                  :status="examRecord.status"
                  :radioStatus="questionArr6[0].record"
                  @getScoreState="getState"
                ></Checked>
              </span>
            </p>
          </td>
          <td colspan="2" style="width: 23.15pt">
            <p class="label">
              <span class="labelFont">
                <input id="input" readonly type="number" value="5" />
              </span>
            </p>
          </td>
          <td colspan="2" style="width: 25.15pt">
            <p class="label">
              <span class="labelFont">
                <input
                  type="number"
                  oninput="if(value>5)value=5;if(value.length>1)value=value.slice(0,1);if(value<0)value=0"
                  name=""
                  v-model="scoreSix"
                  :disabled="disabledScore6"
                />
              </span>
            </p>
          </td>
        </tr>
        <tr style="height: 59.55pt">
          <td rowspan="1">
            <div
              style="
                width: 100%;
                height: 150px;
                display: flex;
                align-items: center;
                justify-content: center;
                font-size: 10pt;
                font-family: 宋体;
              "
            >
              {{ questionArr7[0].questionTypeName }}
            </div>
          </td>
          <td colspan="5" style="width: 117.35pt">
            <div
              style="
                margin: 0pt;
                orphans: 0;
                text-align: justify;
                widows: 0;
                margin-bottom: 15px;
              "
            >
              <span class="labelFont"
                >题号：
                <span>{{ questionArr7[0].questionName }}</span>
                <span
                  class="scorePoint"
                  @click="clickHandle(questionArr7[0].id)"
                  >查看得分点</span
                >
              </span>
            </div>
            <p style="margin: 0pt; orphans: 0; text-align: justify; widows: 0">
              <span style="font-family: 宋体; font-size: 10pt; display: flex"
                ><span> </span
                ><Checked
                  :questionNum="7"
                  :checked="disabled2"
                  :status="examRecord.status"
                  :radioStatus="questionArr7[0].record"
                  @getScoreState="getState"
                ></Checked>
              </span>
            </p>
          </td>
          <td colspan="2" style="width: 23.15pt">
            <p class="label">
              <span class="labelFont">
                <input id="input" readonly type="number" value="10" />
              </span>
            </p>
          </td>
          <td colspan="2" style="width: 25.15pt">
            <p class="label">
              <span class="labelFont">
                <input
                  type="number"
                  oninput="if(value>10)value=10;if(value.length>2)value=value.slice(0,2);if(value<0)value=0"
                  name=""
                  v-model="scoreSeven"
                  :disabled="disabledScore7"
                />
              </span>
            </p>
          </td>
        </tr>
        <tr style="height: 59.55pt">
          <td rowspan="1">
            <div
              style="
                width: 100%;
                height: 150px;
                display: flex;
                align-items: center;
                justify-content: center;
                font-size: 10pt;
                font-family: 宋体;
              "
            >
              {{ questionArr8[0].questionTypeName }}
            </div>
          </td>
          <td colspan="5" style="width: 117.35pt">
            <div
              style="
                margin: 0pt;
                orphans: 0;
                text-align: justify;
                widows: 0;
                margin-bottom: 15px;
              "
            >
              <span class="labelFont"
                >题号：
                <span>{{ questionArr8[0].questionName }}</span>
                <span
                  class="scorePoint"
                  @click="clickHandle(questionArr8[0].id)"
                  >查看得分点</span
                >
              </span>
            </div>
            <p style="margin: 0pt; orphans: 0; text-align: justify; widows: 0">
              <span style="font-family: 宋体; font-size: 10pt; display: flex"
                ><span> </span
                ><Checked
                  :questionNum="8"
                  :checked="disabled2"
                  :status="examRecord.status"
                  :radioStatus="questionArr8[0].record"
                  @getScoreState="getState"
                ></Checked>
              </span>
            </p>
          </td>
          <td colspan="2" style="width: 23.15pt">
            <p class="label">
              <span class="labelFont">
                <input id="input" readonly type="number" value="30" />
              </span>
            </p>
          </td>
          <td colspan="2" style="width: 25.15pt">
            <p class="label">
              <span class="labelFont">
                <input
                  type="number"
                  oninput="if(value>30)value=30;if(value.length>2)value=value.slice(0,2);if(value<0)value=0"
                  name=""
                  v-model="scoreEight"
                  :disabled="disabledScore8"
                />
              </span>
            </p>
          </td>
        </tr>
        <tr style="height: 59.55pt">
          <td rowspan="1">
            <div
              style="
                width: 100%;
                height: 150px;
                display: flex;
                align-items: center;
                justify-content: center;
                font-size: 10pt;
                font-family: 宋体;
              "
            >
              {{ questionArr9[0].questionTypeName }}
            </div>
          </td>
          <td colspan="5" style="width: 117.35pt">
            <div
              style="
                margin: 0pt;
                orphans: 0;
                text-align: justify;
                widows: 0;
                margin-bottom: 15px;
              "
            >
              <span class="labelFont"
                >题号：
                <span>{{ questionArr9[0].questionName }}</span>
                <span
                  class="scorePoint"
                  @click="clickHandle(questionArr9[0].id)"
                  >查看得分点</span
                >
              </span>
            </div>
            <p style="margin: 0pt; orphans: 0; text-align: justify; widows: 0">
              <span style="font-family: 宋体; font-size: 10pt; display: flex"
                ><span> </span
                ><Checked
                  :questionNum="9"
                  :checked="disabled2"
                  :status="examRecord.status"
                  :radioStatus="questionArr9[0].record"
                  @getScoreState="getState"
                ></Checked>
              </span>
            </p>
          </td>
          <td colspan="2" style="width: 23.15pt">
            <p class="label">
              <span class="labelFont">
                <input id="input" readonly type="number" value="5" />
              </span>
            </p>
          </td>
          <td colspan="2" style="width: 25.15pt">
            <p class="label">
              <span class="labelFont">
                <input
                  type="number"
                  oninput="if(value>5)value=5;if(value.length>1)value=value.slice(0,1);if(value<0)value=0"
                  name=""
                  v-model="scoreNine"
                  :disabled="disabledScore9"
                />
              </span>
            </p>
          </td>
        </tr>

        <tr style="height: 59.55pt">
          <td rowspan="1" style="width: 22.8pt">
            <p class="label">
              <span style="font-family: 宋体; font-size: 10pt; width: 90px"
                >其他</span
              >
            </p>
          </td>
          <td rowspan="1" style="width: 40.15pt">
            <p class="label">
              <span class="labelFont">不合格项</span>
            </p>
          </td>
          <td colspan="6" style="width: 117.35pt">
            <p
              style="margin: 0pt; orphans: 0; text-align: justify; widows: 0"
            ></p>
            <p style="margin: 0pt; orphans: 0; text-align: justify; widows: 0">
              <span style="font-family: 宋体; font-size: 10pt; display: flex"
                ><span style="width: 100px"></span>
                <el-checkbox-group v-model="checkList" @change="checkboxHandle">
                  <el-checkbox label="撞倒警示杆"></el-checkbox>
                  <el-checkbox label="未完成指定路线行驶"></el-checkbox>
                  <el-checkbox label="未戴安全帽"></el-checkbox>
                  <el-checkbox label="不听从指挥指令"></el-checkbox>
                  <el-checkbox label="违规操作"></el-checkbox>
                  <el-checkbox label="违反考试纪律"></el-checkbox>
                  <el-checkbox label="主动放弃"></el-checkbox>
                  <el-checkbox label="其他"></el-checkbox>
                </el-checkbox-group>
                <div></div>
              </span>
            </p>
          </td>
          <td colspan="2" style="width: 23.15pt">
            <p class="label">
              <span class="labelFont">/</span>
            </p>
          </td>
          <td colspan="2" style="width: 25.15pt">
            <p class="label">
              <span class="labelFont"> / </span>
            </p>
          </td>
        </tr>

        <tr style="height: 37.25pt">
          <td colspan="2" style="width: 73.75pt">
            <p class="label">
              <span class="labelFont">现场考评人员</span>
            </p>
          </td>
          <td colspan="10" style="vertical-align: bottom; width: 451.6pt">
            <p style="margin: 0pt; orphans: 0; widows: 0">
              <Upload
                @clickUpload="clickUpload"
                :status="examRecord.status"
              ></Upload>
              <span class="labelFont">{{ currentDate }}</span>
            </p>
          </td>
        </tr>
        <tr style="height: 0pt">
          <td style="width: 33.6pt; border: none"></td>
          <td style="width: 50.95pt; border: none"></td>
          <td style="width: 124.8pt; border: none"></td>
          <td style="width: 139.55pt; border: none"></td>
          <td style="width: 128.15pt; border: none"></td>
          <td style="width: 33.95pt; border: none"></td>
          <td style="width: 35.95pt; border: none"></td>
        </tr>
      </table>
    </div>
    <p class="label">
      <span style="font-family: 宋体; font-size: 10pt; font-weight: bold"
        >实操考试要求及注意事项</span
      >
    </p>
    <p style="margin: 0pt; orphans: 0; text-indent: 10.5pt; widows: 0">
      <span class="labelFont">:1、实际操作技能考试采用现场实际操作方式。</span>
    </p>
    <p style="margin: 0pt; orphans: 0; text-indent: 10.5pt; widows: 0">
      <span class="labelFont">
        2、实操考试满分为 100 分，综合评分达到 70 分，判定为“合格”。</span
      >
    </p>
    <p style="margin: 0pt; orphans: 0; text-indent: 10.5pt; widows: 0">
      <span class="labelFont">3、有不合格项时，成绩记零分。</span>
    </p>
    <p
      style="
        line-height: 1pt;
        margin: 0pt;
        orphans: 0;
        text-align: justify;
        widows: 0;
      "
    >
      <span style="font-family: 'Times New Roman'; font-size: 10.5pt"> </span>
    </p>
    <p
      style="
        line-height: 1pt;
        margin: 0pt;
        orphans: 0;
        text-align: justify;
        widows: 0;
      "
    >
      <span style="font-family: 'Times New Roman'; font-size: 10.5pt"> </span>
    </p>
    <p
      style="
        line-height: 1pt;
        margin: 0pt;
        orphans: 0;
        text-align: justify;
        widows: 0;
      "
    >
      <span style="font-family: 'Times New Roman'; font-size: 10.5pt"> </span>
    </p>
    <p
      style="
        line-height: 1pt;
        margin: 0pt;
        orphans: 0;
        text-align: justify;
        widows: 0;
      "
    >
      <span style="font-family: 'Times New Roman'; font-size: 10.5pt"> </span>
    </p>
    <p
      style="
        line-height: 1pt;
        margin: 0pt;
        orphans: 0;
        text-align: justify;
        widows: 0;
      "
    >
      <span style="font-family: 'Times New Roman'; font-size: 10.5pt"> </span>
    </p>
    <p
      style="
        line-height: 1pt;
        margin: 0pt;
        orphans: 0;
        text-align: justify;
        widows: 0;
      "
    >
      <span style="font-family: 'Times New Roman'; font-size: 10.5pt"> </span>
    </p>
    <button class="submitBtn" @click="updateRecord">提交</button>
    <el-dialog title="得分点" :visible.sync="isShow" width="80%">
      <el-table :data="pointData">
        <el-table-column width="500px" prop="name" label="得分点">
        </el-table-column>
        <el-table-column width="100px" prop="score" label="分数">
        </el-table-column>
      </el-table>

      <span slot="footer" class="dialog-footer">
        <el-button type="primary" @click="isShow = false">确 定</el-button>
      </span>
    </el-dialog>
    <div class="shdowImg" v-if="imgNumFlag" @click="imgNumFlag = false">
      <img :src="imgNum" alt="" />
    </div>
    <div style="display: none">
      <video ref="video" autoplay></video>
      <button @click="takePhoto">拍照</button>
      <canvas ref="canvas" style="display: none"></canvas>
    </div>
  </div>
</template>

<script>
import { getCurrentDate, updateCurrentTime } from "../../utils/getTime";
import vueEsign from "../../components/VueEsign.vue";
import Checked from "../../components/checked.vue";
import Upload from "../../components/upload.vue";
import MessageBox from "../../components/messageBox.vue";
import $api from "../../utils/api";
export default {
  components: {
    vueEsign,
    Checked,
    Upload,
    MessageBox,
  },
  data() {
    return {
      stream: null,
      imgSrc: "",
      // 考生个人信息
      examCandidate: "",
      // 考试所有题目
      question: "",
      // 考试科目信息
      examRecord: "",
      // 考试题目标题
      questionTypeNameArr: [],
      // 考试题目分类
      questionArr1: [],
      questionArr2: [],
      questionArr3: [],
      questionArr4: [],
      questionArr5: [],
      questionArr6: [],
      questionArr7: [],
      questionArr8: [],
      questionArr9: [],
      //得分
      scoreOne: "",
      scoreTwo: "",
      scoreThree: "",
      scoreFour: "",
      scoreFive: "",
      scoreSix: "",
      scoreSeven: "",
      scoreEight: "",
      scoreNine: "",
      //考察点弹框
      isShow: false,
      //考察点数据
      pointData: [],
      radio: "",
      MNJdata: [
        { questionName: "", id: "" },
        { questionName: "", id: "" },
      ],
      disabled: false, //上面的radio
      disabled2: false, //下面的radio
      checkList: [],
      options: [
        "撞倒警示杆",
        "未完成指定路线行驶",
        "未戴安全帽",
        "不听从指挥指令",
        "违规操作",
        "违反考试纪律",
        "主动放弃",
        "其他",
      ], // 所有复选框的选项
      disabledScore1: true,
      disabledScore2: true,
      disabledScore3: true,
      disabledScore4: true,
      disabledScore5: true,
      disabledScore6: true,
      disabledScore7: true,
      disabledScore8: true,
      disabledScore9: true,
      uploadFlag: false,
      imgNum: "",
      imgNumFlag: false,
      getStateStatus: null,
    };
  },
  watch: {
    getStateStatus(n, o) {
      if (n) {
        this.disabled2 = true;
      }
      if (!n) {
        this.disabled = true;
      }
    },
    scoreOne(o, n) {
      this.takePhoto(1);
    },
    scoreNine(o, n) {
      this.takePhoto(2);
    },
  },
  computed: {
    sum() {
      // 使用 Number 函数确保结果为数字类型
      return (
        Number(this.scoreOne) +
        Number(this.scoreTwo) +
        Number(this.scoreThree) +
        Number(this.scoreFour) +
        Number(this.scoreFive) +
        Number(this.scoreSix) +
        Number(this.scoreSeven) +
        Number(this.scoreEight) +
        Number(this.scoreNine)
      );
    },
    selectedStatus() {
      return this.options
        .filter((item) => this.checkList.includes(item))
        .map((item) => `☑ ${item}`);
    },
    unselectedStatus() {
      return this.options
        .filter((item) => !this.checkList.includes(item))
        .map((item) => `□ ${item}`);
    },
  },
  destroyed() {
    let status = localStorage.getItem("status");
    if (status == "1") {
      localStorage.removeItem("errorCheckList");
    }
  },
  created() {
    this.userInfo = JSON.parse(localStorage.getItem("data"));
    this.examCandidate = this.userInfo.examCandidate;
    this.question = this.userInfo.question;
    this.examRecord = this.userInfo.examRecord;
    // 判断是否已经上传过签名，上传则直接回显
    if (this.examRecord.assessor1 && this.examRecord.assessor2) {
      this.uploadFlag = true;
    }
    this.questionType(this.userInfo.question);
    this.openCamera();
    this.currentDate = getCurrentDate(); // 默认格式 'YYYY-MM-DD'

    // 部件识别已填写，则回显禁用
    if (this.question[0].getScore) {
      this.disabled = true;
      this.scoreOne = this.question[0].getScore;
      this.scoreTwo = this.question[1].getScore;
      this.scoreThree = this.question[2].getScore;
      this.scoreFour = this.question[3].getScore;
      this.scoreFive = this.question[4].getScore;
    }
    // 基本操作能力已填写，则回显禁用
    if (this.question[5].getScore) {
      this.disabled2 = true;
      this.scoreSix = this.question[5].getScore;
      this.scoreSeven = this.question[6].getScore;
      this.scoreEight = this.question[7].getScore;
      this.scoreNine = this.question[8].getScore;
    }

    // const disabledStatus = localStorage.getItem("disabledStatus");
    // if (disabledStatus == null) {
    //   this.disabled = false;
    //   this.disabled2 = false;
    // }

    // if (disabledStatus == 1) {
    //   this.disabled = true;
    //   this.scoreOne = this.question[0].getScore;
    //   this.scoreTwo = this.question[1].getScore;
    //   this.scoreThree = this.question[2].getScore;
    //   this.scoreFour = this.question[3].getScore;
    //   this.scoreFive = this.question[4].getScore;
    // }
    // if (disabledStatus == 2) {
    //   this.disabled2 = true;
    //   this.scoreSix = this.question[5].getScore;
    //   this.scoreSeven = this.question[6].getScore;
    //   this.scoreEight = this.question[7].getScore;
    //   this.scoreNine = this.question[8].getScore;
    // }
    let errorCheckList = localStorage.getItem("errorCheckList");

    errorCheckList ? (this.checkList = errorCheckList.split(",")) : "";
  },
  methods: {
    async openCamera() {
      try {
        this.stream = await navigator.mediaDevices.getUserMedia({
          video: true,
        });
        this.$refs.video.srcObject = this.stream;
      } catch (error) {
        console.error("无法打开摄像头", error);
      }
    },
    takePhoto(times) {
      const video = this.$refs.video;
      const canvas = this.$refs.canvas;
      canvas.width = video.videoWidth;
      canvas.height = video.videoHeight;
      canvas.getContext("2d").drawImage(video, 0, 0);
      this.imgSrc = canvas.toDataURL("image/png");
      switch (times) {
        case 1:
          localStorage.setItem("examinerImg1", this.imgSrc);
          break;
        case 2:
          localStorage.setItem("examinerImg2", this.imgSrc);
          break;
        case 3:
          localStorage.setItem("examinerImg3", this.imgSrc);
          break;
      }
    },
    checkedImg(num, src) {
      this.imgNumFlag = true;
      switch (num) {
        case 1:
          this.imgNum = "/api" + src;
          break;

        case 2:
          this.imgNum = "/api" + src;
          break;
      }
    },
    clickUpload(e) {
      this.uploadFlag = e;
      this.takePhoto(3);
    },
    clickHandle(questionId) {
      this.isShow = true;
      $api.getPoint(questionId).then((res) => {
        this.pointData = [];
        if (res.status == "200" && res.data.code == "200") {
          res.data.data.forEach((item) => {
            this.pointData.push({
              name: item.name,
              score: item.score,
            });
          });
        }
      });
      this.isShow = true;
    },
    questionType(question) {
      // // 获取考试题目标题和题目
      // let questionTypeNameArr = [];
      // question.forEach((item) => {
      //   if (questionTypeNameArr.indexOf(item.questionTypeName) == "-1") {
      //     questionTypeNameArr.push(item.questionTypeName);
      //   }
      // });
      // this.questionTypeNameArr = questionTypeNameArr;
      // question.forEach((item) => {
      //   if (item.questionTypeName == questionTypeNameArr[0]) {
      //     this.questionArr1.push(item);
      //   }
      //   if (item.questionTypeName == questionTypeNameArr[1]) {
      //     this.questionArr2.push(item);
      //   }
      //   if (item.questionTypeName == questionTypeNameArr[2]) {
      //     this.questionArr3.push(item);
      //   }
      //   if (item.questionTypeName == questionTypeNameArr[3]) {
      //     this.questionArr4.push(item);
      //   }
      // });
      this.questionArr1.push(question[0]);
      this.questionArr2.push(question[1]);
      this.questionArr3.push(question[2]);
      this.questionArr4.push(question[3]);
      this.questionArr5.push(question[4]);
      this.questionArr6.push(question[5]);
      this.questionArr7.push(question[6]);
      this.questionArr8.push(question[7]);
      this.questionArr9.push(question[8]);
    },
    updateRecord() {
      let question = this.question;
      let examRecord = this.examRecord;

      if (this.disabled2 && question) {
        question[0].record = localStorage.getItem("record1");
        question[0].getScore = this.scoreOne;
        question[1].record = localStorage.getItem("record2");
        question[1].getScore = this.scoreTwo;
        question[2].record = localStorage.getItem("record3");
        question[2].getScore = this.scoreThree;
        question[3].record = localStorage.getItem("record4");
        question[3].getScore = this.scoreFour;
        question[4].record = localStorage.getItem("record5");
        question[4].getScore = this.scoreFive;
      }
      if (this.disabled && question) {
        question[5].record = localStorage.getItem("record6");
        question[5].getScore = this.scoreSix;
        question[6].record = localStorage.getItem("record7");
        question[6].getScore = this.scoreSeven;
        question[7].record = localStorage.getItem("record8");
        question[7].getScore = this.scoreEight;
        question[8].record = localStorage.getItem("record9");
        question[8].getScore = this.scoreNine;
      }
      if (examRecord && examRecord.status !== "2") {
        if (
          localStorage.getItem("imgUrl1") &&
          localStorage.getItem("imgUrl2") &&
          this.uploadFlag
        ) {
          examRecord.assessor1 = localStorage.getItem("imgUrl1");
          examRecord.assessor2 = localStorage.getItem("imgUrl2");
        } else {
          this.$alert("请上传签名", "提示", {
            confirmButtonText: "确定",
            callback: (action) => {},
          });
          return;
        }
      }
      if (this.checkList.length > 0) {
        examRecord.score = 0;
      } else {
        examRecord.score = this.sum;
      }

      examRecord.questionList = question;
      examRecord.disqualification = [
        ...this.selectedStatus,
        ...this.unselectedStatus,
      ].toString();
      let result = examRecord.status == "0" ? "保存" : "提交";
      this.$confirm("确定" + result + "吗", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          let flag = true;
          if (this.disabled) {
            // localStorage.setItem("disabledStatus", 2);
            examRecord.questionList = examRecord.questionList.slice(-4);
            examRecord.questionList.forEach((item) => {
              if (item.getScore === "") {
                this.$alert("部分考核项目未评分", "提示", {
                  confirmButtonText: "确定",
                  callback: (action) => {},
                });
                flag = false;
              }
            });
          }
          if (this.disabled2) {
            // localStorage.setItem("disabledStatus", 1);
            examRecord.questionList = examRecord.questionList.slice(0, 6);
            examRecord.questionList.forEach((item) => {
              if (item.getScore === "") {
                this.$alert("部分考核项目未评分", "提示", {
                  confirmButtonText: "确定",
                  callback: (action) => {},
                });
                flag = false;
              }
            });
          }
          if (!this.disabled2 && !this.disabled) {
            this.$alert("部分考核项目未评分", "提示", {
              confirmButtonText: "确定",
              callback: (action) => {},
            });
            flag = false;
          }
          if (flag) {
            switch (result) {
              case "保存":
                examRecord.status = "2";
                break;
              case "提交":
                examRecord.status = "1";
                let examinerImg1 = localStorage.getItem("examinerImg1");
                let examinerImg2 = localStorage.getItem("examinerImg2");
                let examinerImg3 = localStorage.getItem("examinerImg3");
                examRecord.examinerImg1 = examinerImg1;
                examRecord.examinerImg2 = examinerImg2;
                examRecord.examinerImg3 = examinerImg3;
                localStorage.setItem("status", "1");
                localStorage.removeItem("disabledStatus");
                break;
            }
            $api.updateRecord(examRecord).then((res) => {
              if (res.data.code == "200") {
                this.$message({
                  type: "success",
                  message: result + "成功!",
                });
                this.$router.push({
                  name: "home",
                });
              }
            });
          }
        })
        .catch(() => {
          this.$message({
            type: "info",
            message: "已取消",
          });
        });
    },
    checkedType(e) {
      let machineType;
      if (e == "1") {
        machineType = "1";
      } else if (e == "2") {
        machineType = "2";
      }
      this.checkedId = true;
      $api.getQuestionsByType(machineType).then((res) => {
        if ((res.code = "200")) {
          if (res.data.data) {
            this.MNJdata = res.data.data;
          }
        }
      });
    },
    getState(state, number) {
      if (number == "1") {
        this.getStateStatus = true;
        state == "正确"
          ? (this.scoreOne = 8)
          : state == "错误"
          ? (this.scoreOne = 0)
          : (this.scoreOne = "");
        state == "部分错误"
          ? (this.disabledScore1 = false)
          : (this.disabledScore1 = true);
      }
      if (number == "2") {
        this.getStateStatus = true;
        state == "正确"
          ? (this.scoreTwo = 8)
          : state == "错误"
          ? (this.scoreTwo = 0)
          : (this.scoreTwo = "");
        state == "部分错误"
          ? (this.disabledScore2 = false)
          : (this.disabledScore2 = true);
      }
      if (number == "3") {
        this.getStateStatus = true;
        state == "正确"
          ? (this.scoreThree = 8)
          : state == "错误"
          ? (this.scoreThree = 0)
          : (this.scoreThree = "");
        state == "部分错误"
          ? (this.disabledScore3 = false)
          : (this.disabledScore3 = true);
      }
      if (number == "4") {
        this.getStateStatus = true;
        state == "正确"
          ? (this.scoreFour = 6)
          : state == "错误"
          ? (this.scoreFour = 0)
          : (this.scoreFour = "");
        state == "部分错误"
          ? (this.disabledScore4 = false)
          : (this.disabledScore4 = true);
      }
      if (number == "5") {
        this.getStateStatus = true;
        state == "正确"
          ? (this.scoreFive = 20)
          : state == "错误"
          ? (this.scoreFive = 0)
          : (this.scoreFive = "");
        state == "部分错误"
          ? (this.disabledScore5 = false)
          : (this.disabledScore5 = true);
      }
      if (number == "6") {
        this.getStateStatus = false;
        state == "正确"
          ? (this.scoreSix = 5)
          : state == "错误"
          ? (this.scoreSix = 0)
          : (this.scoreSix = "");
        state == "部分错误"
          ? (this.disabledScore6 = false)
          : (this.disabledScore6 = true);
      }
      if (number == "7") {
        this.getStateStatus = false;
        state == "正确"
          ? (this.scoreSeven = 10)
          : state == "错误"
          ? (this.scoreSeven = 0)
          : (this.scoreSeven = "");
        state == "部分错误"
          ? (this.disabledScore7 = false)
          : (this.disabledScore7 = true);
      }
      if (number == "8") {
        this.getStateStatus = false;
        state == "正确"
          ? (this.scoreEight = 30)
          : state == "错误"
          ? (this.scoreEight = 0)
          : (this.scoreEight = "");
        state == "部分错误"
          ? (this.disabledScore8 = false)
          : (this.disabledScore8 = true);
      }
      if (number == "9") {
        this.getStateStatus = false;
        state == "正确"
          ? (this.scoreNine = 5)
          : state == "错误"
          ? (this.scoreNine = 0)
          : (this.scoreNine = "");
        state == "部分错误"
          ? (this.disabledScore9 = false)
          : (this.disabledScore9 = true);
      }
    },
    checkboxHandle() {
      localStorage.setItem("errorCheckList", this.checkList);
    },
  },
};
</script>
<style lang="less" scoped>
@import "./css/index.less";
.el-dialog__headerbtn .el-dialog__close {
  display: none;
}
.shdowImg {
  width: 100%;
  height: 100%;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1111;
  background-color: rgba(255, 255, 255, 0.9);
}
.shdowImg > img {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}
.img1 {
  width: 100px;
  height: 50px;
}
.img2 {
  width: 50px;
  height: 50px;
}
</style>
